<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
.search th{border:1px solid #ccc;background:#E6EFF6;font-weight:normal;}
.search td{border:1px solid #ccc;}
</style>
<script language="javascript" type="text/javascript" src="{res file=js/jquery-1.2.6.js}"></script>
<script language="javascript" type="text/javascript" src="{lib file=jquery.plugins/jquery.validate.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/lan.js}"></script>
<script language="javascript" type="text/javascript">
$(function() {
$('th[type="order"]').click(function() {
var order = $(this).attr('field') + '-' + $(this).attr('order');
$('#order').val(order);
$('input[name="search"]').click();
}).css({'cursor': 'pointer', 'color': '#36c'});
var order = $('#order').val().split('-');
var field = $('th[type="order"][field="' + order[0] + '"]');
if (order[1] == 'ASC') {
field.attr('order', 'DESC').text(field.text() + '↑');
} else {
field.attr('order', 'ASC').text(field.text() + '↓');
}
if (order[0] != 'arrival_date') {
$('th[type="order"][field="arrival_date"]').attr('order', 'DESC');
}
var isdblclick=0;
$('[type="ajax_edit"]').dblclick(function() {
if(isdblclick==0)
{
var value = $(this).html();
}
else if(isdblclick==1)
{
var value = $(this).text();
}
isdblclick=1;
//$(this).unbind('dblclick');
//var value = $(this).html();
//alert(value);
$(this).html('');
var textarea = $('<textarea style="width:300px; height:80px;" ondblclick="return false;" >' + value + '</textarea>');

//textarea.select();
var id = $(this).attr('id');
var field = $(this).attr('field');
textarea.blur(function() {

var _self = $(this);
$.post('index.php?app=order&act=ajax_edit&id=' + id, {'field' : field, 'value' : $(this).val()}, function(json) {
if (!json.done) {
alert(json.msg);
} else {
isdblclick=0;
_self.parent().html(nl2br(_self.val()));
//_self.parent().bind('dblclick');
}
}, 'json');
});
$(this).append(textarea);
textarea.focus();
});
});
function init_order(order_id) {
$.get('index.php?app=order&act=init_order&id=' + order_id, function(json) {
location.href = location.href;
}, 'json');
}
function nl2br (str) {
var arr = str.split('\n');
var ret = '';
for (var i = 0; i < arr.length; i++) {
ret += arr[i];
if (i != arr.length - 1) {
ret += '<br>\n';
}
}
return ret;
}
</script>
<link href="template/style/css/style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div class="sub-body">
	<div id="head">
		<div  id="search">
			<form action="index.php" method="get">
					<table width="80%" cellspacing="0" cellpadding="0" class="search">
						<tr>
							<th width="100">订&nbsp;单&nbsp;号：</th>
							<td width="200"><input type="text" id="order_sn" name="order_sn" class="input-1" value="{$smarty.get.order_sn}" /></td>
							<th width="100">款&nbsp;&nbsp;&nbsp;&nbsp;号：</th>
							<td width="200"><input type="text" id="style_sn" name="style_sn" class="input-1" value="{$smarty.get.style_sn}" /></td>
                            <th width="100">品&nbsp;&nbsp;&nbsp;&nbsp;牌：</th>
							<td width="200"><select name="brand_id" id="brand_id" onChange="brand_change(this.value);">
									<option value="0"></option>
									<!--{foreach from=$brand_list item=brand key=k}-->
									<option value="{$brand.brand_id}"{if $smarty.get.brand_id == $brand.brand_id} selected{/if}>{$brand.brand_name}&nbsp;&nbsp;({$brand.company_name|escape})</option>
									<!--{/foreach}-->
								</select></td>
							<td width="100" rowspan="2"><input type="hidden" name="app" value="order" />
								<input type="hidden" name="act" value="receipt_list" />
								<input type="hidden" name="order" id="order" value="{if $smarty.get.order}{$smarty.get.order}{else}order_create_date-DESC{/if}" />
								<input type="submit" name="search" value="查询" class="inquiry" /></td>
                                	
						</tr>
						<tr>
						
							<th>买&nbsp;&nbsp;&nbsp;&nbsp;手：</th>
							<td><select name="buyer_id" id="buyer_id" onChange="buyer_change(this.value);">
									<option value="0"></option>
									<!--{foreach from=$buyer_list item=buyer}-->
									<option value="{$buyer.user_id}"{if $smarty.get.buyer_id == $buyer.user_id} selected{/if}>{$buyer.user_name}</option>
									<!--{/foreach}-->
								</select></td>
							<th>跟&nbsp;&nbsp;&nbsp;&nbsp;单：</th>
							<td><select name="merchandiser_id" id="merchandiser_id">
									<option value="0"></option>
									<!--{foreach from=$merchandiser_list item=merchandiser}-->
									<option value="{$merchandiser.user_id}"{if $smarty.get.merchandiser_id == $merchandiser.user_id} selected{/if}>{$merchandiser.user_name}</option>
									<!--{/foreach}-->
								</select></td>
                                	<th class="right">工&nbsp;&nbsp;&nbsp;&nbsp;厂：</th>
							<td><select name="factory_id" id="factory_id">
									<option value="0"></option>
									<!--{foreach from=$factory_list item=factory}-->
									<option value="{$factory.factory_id}"{if $smarty.get.factory_id == $factory.factory_id} selected{/if}>{$factory.factory_name}</option>
									<!--{/foreach}-->
								</select></td>
						</tr>
					</table>
				</form>
			<script>
<!--{if $role==USER_MERCHANDISER}-->
//$('#brand_id').attr('disabled','disabled');
//$('#buyer_id').attr('disabled','disabled');
$('#merchandiser_id option:first-child').remove();
$('#merchandiser_id').val('{$user.user_id}');
$('#merchandiser_id').attr('readonly','readonly');
<!--{/if}-->
</script> 
		</div>
	</div>
	<div class="tab_info" id="order_list">
		<div class="tab-title-1"><span>收货排期列表</span></div>
		<table width="100%" cellspacing="0" cellpadding="0" class="tab-display" id="tab-color1">
			<tr>
				<th width="3%">序号</th>
				<th width="7%" type="order" field="order_create_date" order="ASC">下单日期</th>
				<th width="4%" type="order" field="brand_name" order="ASC">品牌</th>
				<th width="6%" type="order" field="buyer_name" order="ASC">买手</th>
				<th width="6%" type="order" field="merchandiser" order="ASC">跟单</th>
				<th width="6%">订单号</th>
				<th type="order" field="style_sn" order="ASC"  width="6%">款号</th>
				<th width="8%" type="order" field="factory_name" order="ASC">工厂</th>
				<th width="7%">工厂入仓日期</th>
				<th width="7%">收货日期</th>
                <th width="5%">订单状态</th>
                <th width="6%">qc</th>
                <th width="6%">制单</th>
			</tr>
			<!--{foreach from=$receipt_list item=order key=k name=o}-->
			<tr>
				<td>{$smarty.foreach.o.iteration}</td>
				<td>{$order.order_create_date|date}</td>
				<td>{$order.brand_name}</td>
				<td>{$order.buyer_name}</td>
				<td>{$order.merchandiser}</td>
				<td>{$order.order_sn|default:-}</td>
				<td>{$order.style_sn}</td>
				<td>{$order.factory_name}</td>
				<td>{$order.release_date|date}</td>
				<td><!-- {if $order.receipt_date} -->{$order.receipt_date|date}<!-- {/if} --></td>
                <td>{$lang.order_status.$order.status}</td>
                <td>{$order.qc_name}</td>
                <th><!-- {if $order.ss_id} --><a href="{url app=ss&ss_id=$order.ss_id}">查看</a><!-- {/if} --></th>
			</tr>
			<!--{/foreach}-->
		</table>
		<div class="page"> {include file=page.html}</div>
	</div>
	<div id="order_info"> </div>
</div>
<script language="javascript" type="text/javascript" src="{res file=js/tab_color.js}"></script>
</body>
</html>
